package com.demo.webapp.service.impl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityConfig;
import org.springframework.security.access.annotation.Jsr250SecurityConfig;
import org.springframework.security.web.util.AntPathRequestMatcher;
import org.springframework.security.web.util.RequestMatcher;
import org.springframework.util.Assert;

import com.demo.common.StringUtils;
import com.demo.core.model.Function;
import com.demo.core.model.Role;
import com.demo.core.model.Site;
import com.demo.core.model.SiteFunction;
import com.demo.core.service.base.SiteFunctionService;
import com.demo.core.service.base.SiteService;
import com.demo.security.access.model.SecurityResource;

/**
 * 
 * WEB资源调用元数据安全资源工厂
 * 产生安全资源模型FunctionService
 * 目的为Spring提供对象，依赖注入。
 * <br>
 * 
 * @author ryuu.kk
 *
 */
public class MethodSecurityMetadataSourceBuilder implements FactoryBean<List<SecurityResource>>, InitializingBean {
	
	/**
	 * Log日志
	 */
	protected final Log logger = LogFactory.getLog(getClass());
	
	/**
	 * single model
	 */
	private boolean isSingleton = false;
	
	@Override
	public List<SecurityResource> getObject() throws Exception {
		
		if (logger.isDebugEnabled()) {
			// 
			logger.debug("SecurityMetadataSource init....");
		}
		// List<SecurityResource> list = functionService.selectUnion(resourceType, true);
		//TODO:处理...
		return null;
	}
	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public Class getObjectType() {
		return (Class) List.class;
	}

	@Override
	public boolean isSingleton() {
		return isSingleton;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		// TODO Auto-generated method stub
	}
}
